package pATT.DataSetsGenerator.dataSetsGenerator.core.implement;

import java.util.Vector;

import pATT.DataSetsGenerator.dataSetsGenerator.attribute.implement.Attribute;


public class Relation {
	
	private int id = -1;
	private String name = "";
	private Vector<Attribute> attributes;
	private int examples=0;
	
	
	public Relation(Vector<Attribute> vecAtributes,String n,int e) {
		attributes = vecAtributes;
		name=n;
		examples=e;
	}
	
	
	@SuppressWarnings("unchecked")
	public Vector<Attribute> getNonNumericAttr(){
		Vector<Attribute> nonNumeric = new Vector<Attribute>();
		for (int i = 0; i < attributes.size(); i++) {
			if(!attributes.elementAt(i).getType().equals("Integer") && !attributes.elementAt(i).getType().equals("Real"))
				System.out.println("---->Type: "+attributes.elementAt(i).getType());
				nonNumeric.add(attributes.elementAt(i));
		}
		return nonNumeric;
	}
	
	public int getQuantityNumericAttr(){
		int quantity = 0;
		Attribute attr = null;
		for (int i = 0; i < attributes.size(); i++) {
			attr = attributes.elementAt(i);
			if(attr.getType().equals("Integer") || attr.getType().equals("Real"))
				quantity++;			
		}
		return quantity;
	}
	
	public void removeAttribute(int pos){
		if(pos<=attributes.size()){
			System.out.println("pos: "+pos);
			System.out.println("attr: "+ attributes.get(pos));
			
			attributes.remove(pos);
		}
	}
	

	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Vector<Attribute> getAtributes() {
		return attributes;
	}
	public int getExamples() {
		return examples;
	}
	
	
	public void setExamples(int examples) {
		this.examples = examples;
	}

	
	
	
	
}
